package thread;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Creared with IntelliJ IDEA.
 * Description:
 * User:yxd
 * Date:2022-03-29
 * Time:15:31
 */
public class Demo23 {
    public static void main(String[] args) {
        Timer t = new Timer();
        t.schedule(new TimerTask() {//timeTask其实就是一个升级版本的runnable
            @Override
            public void run() {
                System.out.println("hello");
            }
        },1000);//前面是代码,后面是具体的时间(多长时间后执行)
        System.out.println("main");
    }
}
